#-*- coding=UTF-8 -*-
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(14,GPIO.IN)
GPIO.setup(15,GPIO.OUT)

try:
  while True:
    if GPIO.input(14)==1:
     #print("有人来啦")
      GPIO.output(15,GPIO.HIGH)
      time.sleep(0.2)
      GPIO.output(15,GPIO.LOW)
    else:
     #print("没有人")
      GPIO.output(15,GPIO.LOW)
    #time.sleep(1)
except KeyboardInterrupt:
  GPIO.cleanup()
  print "All Cleanup!"
